#include <stdio.h>

int main() {
    char str[1000];
    int letter = 0, space = 0, digit = 0, other = 0, i = 0;
    printf("请输入一行字符：\n");
    // 读取一行字符
    while ((str[i] = getchar()) != '\n') {
        i++;
    }
    str[i] = '\0';
    // 遍历统计
    for (i = 0; str[i] != '\0'; i++) {
        if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) {
            letter++;
        } else if (str[i] == ' ') {
            space++;
        } else if (str[i] >= '0' && str[i] <= '9') {
            digit++;
        } else {
            other++;
        }
    }
    printf("英文字母：%d，空格：%d，数字：%d，其它字符：%d\n", letter, space, digit, other);
    return 0;
}